#include<iostream>
#include<vector>
#include<map>
#include<tuple>
#include<iterator>
#include<algorithm>
#include<string>
#include<typeinfo>
#include<random>

using namespace std;

namespace std {
template<typename TKey, typename TVal>
ostream& operator<<(ostream& os, const pair<TKey, TVal>& p){
    return os<<"("<<p.first <<", "<<p.second<<")";
}
}

template<typename T>
void print(const vector<T>& v){
    copy(begin(v), end(v), ostream_iterator<T>{cout, ", "});
    cout<<endl;
}
int main(){
    vector<int> v(20);
    random_device rd;
    mt19937 g{rd()};
    
    iota(begin(v), end(v), 1);
    cout<<is_sorted(begin(v), end(v))<<endl;

    shuffle(begin(v), end(v), g);
    print(v);
    auto cmp([](auto x) {return x<5; });
//    partition(begin(v),end(v), cmp);
    auto middle (next(begin(v), int(v.size()/2)));
    partial_sort(begin(v), middle, end(v));
    print(v);
    return 0;
}
